package com.bmlstrategys
{
	import com.strategy.IBML;
	import com.utils.Utils;
	
	import flash.utils.ByteArray;
	
	/**
	 *奖励item解析 
	 * @author Administrator
	 * 
	 */	
	public class CadornInfo extends BMLBase implements IBML
	{
		public function CadornInfo(data:ByteArray)
		{
			super(data);
		}
		
		public function bmlstrategyxml():XML
		{
			//把头读掉
			var num:int = Utils.readHead(bmlData);
			var index:int=0;
			var xmlData:XML = new XML();
			xmlData = <root/>;
			while(index<num){
				xmlData.appendChild(<bonus/>);
				xmlData.bonus[index].@ItemTemplateId = bmlData.readUnsignedInt();
				xmlData.bonus[index].@Attack = "["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@Deffence = "["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@Hit = "["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@Dodge = "["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@CriticalDamage ="["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@CriticalRate ="["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@SkillHit = "["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@SkillDodge = "["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@Hp = "["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@Mp = "["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@Resistance1 = "["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@Resistance2 = "["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@Resistance3 = "["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@Resistance4 = "["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@Resistance5 = "["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@CrtrateReduce = "["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@CrtdmgReduce ="["+transformtoArray(bmlData)+"]";
				xmlData.bonus[index].@DamageReduce = "["+transformtoArray(bmlData)+"]";
				index++;
			}
			
			return xmlData;	
		}
		
		private function transformtoArray(data:ByteArray):Array
		{
			var tempList:Array = new Array();
			tempList.push(data.readUnsignedInt());
			tempList.push(data.readUnsignedInt());
			tempList.push(data.readUnsignedInt());
			return tempList;
		}
	}
}